import { NSkeleton, type SkeletonProps } from "naive-ui";
import type { HTMLAttributes } from "vue";

export type SkeletonFactoryConstructorType = {
  props?: SkeletonProps;
  attrs?: HTMLAttributes;
};

export class SkeletonFactory {
  private attrs: HTMLAttributes = {};
  private props: SkeletonProps = {};
  constructor(param?: SkeletonFactoryConstructorType) {
    if (param?.props) this.setProps(param.props);
    if (param?.attrs) this.setAttrs(param.attrs);
  }
  setAttrs(attrs: HTMLAttributes) {
    this.attrs = attrs;
    return this;
  }
  setProps(props: SkeletonProps) {
    this.props = props;
    return this;
  }
  create() {
    return <NSkeleton {...this.attrs} {...this.props}></NSkeleton>;
  }
}
